<h2>{{ title }}</h2>

<p class="update-n-repositories">{{{ info_mass_update }}}</p>

<form action="{{ form_action }}" method="POST">
    {{# csrf_token }}
        {{> csrf_token_input }}
    {{/ csrf_token }}

    {{# mirroring_presenter }}
        <h4>{{ mirroring_title }}</h4>

        {{# is_exceeding_max_input_vars }}
            <div class="alert alert-warning">{{ exceed_max_input_vars_message }}</div>
        {{/ is_exceeding_max_input_vars }}

        <table class="table mass-mirrors-list">
            <colgroup>
                <col style="width: 20%">
                {{# mirror_presenters }}
                    <col style="width: {{ percent_width }}%">
                {{/ mirror_presenters }}
            </colgroup>
            <thead>
                <tr>
                    <th></th>
                    {{# mirror_presenters }}
                        <th>
                            {{ name }}
                            {{# has_more_than_one_repository }}
                                <div class="check-all-panel">
                                    <a href="#" class="uncheck-all uncheck-all-mirror" data-id="{{ mirror_id }}" data-toggle="tooltip" title="Uncheck all"><i class="fa fa-square-o"></i></a>
                                    <a href="#" class="check-all check-all-mirror" data-id="{{ mirror_id }}" data-toggle="tooltip" title="Check all"><i class="fa fa-check-square-o"></i></a>
                                </div>
                            {{/ has_more_than_one_repository }}
                        </th>
                    {{/ mirror_presenters }}
                </tr>
            </thead>
            <tbody>
                {{# repositories }}
                    <tr>
                        <td>
                            {{ name }}
                            {{# has_more_than_one_mirror }}
                                <div class="check-all-panel">
                                    <a href="#" class="uncheck-all uncheck-all-repository" data-id="{{ repository_id }}" data-toggle="tooltip" title="Uncheck all"><i class="fa fa-square-o"></i></a>
                                    <a href="#" class="check-all check-all-repository" data-id="{{ repository_id }}" data-toggle="tooltip" title="Check all"><i class="fa fa-check-square-o"></i></a>
                                </div>
                            {{/ has_more_than_one_mirror }}
                        </td>
                        {{# used_mirrors }}
                            <td class="{{# is_used }}was-used{{/ is_used }}{{^ is_used }}was-unused{{/ is_used }}">
                                <input
                                    type="hidden"
                                    name="selected_mirror_ids[{{ repository_id }}][{{ mirror_id }}]"
                                    value="0"
                                    />
                                <input
                                    type="checkbox"
                                    name="selected_mirror_ids[{{ repository_id }}][{{ mirror_id }}]"
                                    value="1"
                                    class="check-repository-mirror"
                                    data-repository-id="{{ repository_id }}"
                                    data-mirror-id="{{ mirror_id }}"
                                    {{# is_used }}checked="checked"{{/ is_used }}
                                    />
                                <div class="previous-state label {{# is_used }}label-important{{/ is_used }}{{^ is_used }}label-sucess{{/ is_used }}">
                                    {{# is_used }}
                                        {{ previous_state_used }}
                                    {{/ is_used }}
                                    {{^ is_used }}
                                        {{ previous_state_unused }}
                                    {{/ is_used }}
                                </div>
                            </td>
                        {{/ used_mirrors }}
                    </tr>
                {{/ repositories }}
            </tbody>
        </table>
    {{/ mirroring_presenter }}

    {{# repositories }}
        <input type="hidden" name="repository_ids[]" value="{{ repository_id }}">
    {{/ repositories }}

    <div class="mass-mirrors-list-update-bar">
        <input type="submit" class="btn btn-primary btn-large" id="save-mass-change" name="save-mass-change" value="{{ submit_mass_change }}">
    </div>
</form>
